-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort datadog_downtime monitor tags to avoid plan diffs #540
Sort datadog_downtime monitor tags to avoid plan diffs #540
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR 💯 . I have couple of questions. See my comments 😄
datadog/resource_datadog_downtime.go
Outdated
tags = append(tags, mt.(string)) | ||
} | ||
sort.Strings(tags) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need to sort them if we are using schema.TypeSet
[1] ?
--
[1] https://www.terraform.io/docs/extend/schemas/schema-types.html#typeset
Addresses #577 |
Thanks for cleaning it up @jirikuncar and merging 🥇 |
Once an unsorted list of
monitor_tags
is applied fordatadog_downtime
, Terraform shows a permanent diff because Datadog API responds with an ordered list.This PR builds on https://github.com/terraform-providers/terraform-provider-datadog/pull/214 by changing the type from list to set and applying ordering. I've extended the tests with additional values and replayed cassettes. The fix appears to work using a binary for my use case.